<?php
	
	/**
	 * Verifies bootstrapper execution to ensure file
	 * necessities, and disabling direct access
	 */
	defined('ENGINE') or exit;
	
	/**
	 * HTML encoding with support for language
	 * charsetting
	 */
	function html_encode($string, $charset = 'UTF-8')
	{
		$string = htmlentities($string, ENT_QUOTES, $charset);
		
		/**
		 * htmlspecialchars() does not seem to interpret some of the language
		 * specific characters such as 'æ', 'ø', 'å' of the danish language. 
		 *
		 * Lets crack them down on the old fashion way...
		 */
		$charlist = array(
					/** Danish */
					'æ'	=> '&aelig;', 
					'Æ'	=> '&AElig;', 
					'ø'	=> '&oslash;', 
					'Ø'	=> '&Oslash;', 
					'å'	=> '&aring;', 
					'å'	=> '&Aring;'
		);
		
		return(str_replace(array_keys($charlist), array_values($charlist), $string));
	}

?>